<?php
/**
 * True Gallery back-end settings template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename admin.settings.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');


?>
<script type="text/javascript" lang="javascript">
function showmenuparams(id) {
	var url = TG_FRONTURL+'&view=settings&task=showparams&menuid='+id+'&no_html=1&ax=1';
	document.adminForm.menuid.value = id;
	
	$j("table.adminlist tr").each( function() {
		$j(this).removeClass('highlight');
	});
	$j('#show_params').load( url,'',function() {
			$j("#menu"+id).addClass('highlight');
		}
	);
}
function submitbutton( pressbutton ) {
	var form = document.adminForm;
	if( pressbutton == 'cancel' ) {
		submitform( pressbutton );
		return;
	}
	
	//console.log( form.menuid.value );
	
	if( form.menuid.value == '' ) {
		alert( '<?php echo JText::_('TG_CHOOSE_CONFIG'); ?>' );
	} else {
		if( form.paramsad_path.value == '' ){
			alert('<?php echo JText::_('TG_FIVE_ERR'); ?>');
		}
		else {
			//alert( 'submit' );
			submitform( pressbutton );
		}
	}
}
//$j("td#toolbar-save a.toolbar").css( 'disable', true );
//console.log( $j("td#toolbar-save a.toolbar") );
</script>

<form action="index2.php?option=com_true&view=settings" method="post" name="adminForm">
	
	<div id="menuformContent">
		<!--table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminheading">
			<tr>
				<th class="tg_adminheader tg_pictures"><?php echo JText::_('TG_MENU_MANAGER_TITLE'); ?></th>
			</tr>
		</table-->
		
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
				<th width="50"># ItemID</th>
				<!--th width="20"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php //echo count($rows); ?>);" /></th-->
				<th><?php echo JText::_('TG_TITLE'); ?></th>
				<th><?php echo JText::_('TG_MENUTYPE'); ?></th>
				<!--th width="50"><?php echo JText::_('TG_HITS'); ?></th>
				<th width="100"><?php echo JText::_('TG_RATING'); ?></th-->
				<!--th width="70"><span align="center"><?php echo JText::_('TG_ORDER'); ?></span></th-->
				<!--th width="50">
					<span align="center"><a href="javascript: saveorder( <?php //echo count($rows) - 1; ?> )">
					<img src="<?php echo TG_IMAGESWAY; ?>filesave.png" border="0" width="16" title="<?php echo JText::_('TG_SAVEORDER_PICS'); ?>" alt="" /></a></span>
				</th-->
				<th width="50"><?php echo JText::_('TG_PUBLISHED'); ?></th>
				<th width="50"><?php echo JText::_('TG_APPROWED'); ?></th>
				<th width="100"><?php echo JText::_('TG_AUTHOR_OWNER'); ?></th>
				<!--th width="50"><?php echo JText::_('TG_TYPE'); ?></th>
				<th><?php echo JText::_('TG_DATE_ADD'); ?></th-->
			</tr>
			
			<tr title="0" id="menu0" class="row<?php echo $k; ?>" >
				<td></td>
				<td><a ax="1" href="#showparams" title="<?php ''; ?>" onClick="javascript:showmenuparams(0)">Default</a></td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			
			<?php
			while( $row = mysql_fetch_object($cur) ) {
				$k = 1 - $k;
				$task		= $row->published ? 'publish' : 'unpublish';
				$trashed	= $row->published == -2 ? ' trashed' : '';
				$tr_class	= $row->published ? 'published ' : 'unpublished ';
				
				?><tr title="<?php echo $row->itemid; ?>" id="menu<?php echo $row->itemid; ?>" class="row<?php echo $k.$trashed; ?>" <?php //echo $onmouseover.' '.$onmouseout; ?> >
					<td><?php echo $row->itemid; ?></td>
					<!--td></td-->
					<td>
						<?php if( !$trashed ) { ?><a ax="1" href="#showparams" title="<?php ''; ?>" onClick="javascript:showmenuparams(<?php echo $row->itemid; ?>)"><?php } ?>
						<?php echo $row->name; ?>
						<?php if( !$trashed ) { ?></a><?php } ?>
					</td>
					<td><?php echo $row->menutype; ?></td>
					<!--td></td>
					<td></td-->
					<!--td></td-->
					<!--td></td-->
					<td align="center"><?php 
						if( $trashed ) {
							//JTuneConfig::debug(true);
							$image = JTuneLayout::getImageFile( 'recyclebin', '.png', 'images/admin' );
							?><img title="<?php echo JText::_('This menu in trash'); ?>" src="<?php echo $image; ?>" width="20" height="20"/><?php
						} else {
							echo JTrueSettingsRouterAdmin::publish( $row->published, $row->itemid, 'publish', false ); 
						}
					?></td>
					<td>access</td>
					<td></td>
					<!--td></td>
					<td></td-->
				</tr><?php
			}
			mysql_free_result( $cur );
			?>
			
			<tr>
				<th align="center" colspan="15"><?php //echo $pageNav->writePagesLinks(); ?></th>
			</tr>
			<tr>
				<td align="center" colspan="15"> <?php //echo $pageNav->writePagesCounter(); ?></td>
			</tr>
		</table>
		
		<?php if( JOOMLA_JVERSION=='1.5' ) { ?>
		<!--input type="hidden" name="limit" value="<?php //echo $pageNav->limit;?>" /-->
		<input type="hidden" name="limitstart" value="<?php //echo $pageNav->limitstart;?>" />
		<?php } ?>
		
	</div>
	<div id="show_params">
		<?php ?>
	</div>
	<input type="hidden" name="option" value="<?php echo TG_CMP; ?>" />
	<input type="hidden" name="menuid" value="" />
	<input type="hidden" name="view" value="settings" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="1" />
</form>

<div style="clear:both;"></div>